using System.ComponentModel.DataAnnotations;
using FytSoa.Common.Enum;
using SqlSugar;

namespace FytSoa.Domain.Erp;

/// <summary>
/// erp-产品入库
/// </summary>
[SugarTable("erp_instock")]
public class ErpInstock:Entity
{
    /// <summary>
    /// 入库编号
    /// </summary>
    [Required]
    [StringLength(50)]
    public string Number { get; set; }

    /// <summary>
    /// 入库类型(1=采购2=生产3=销售退货4=其他)
    /// </summary>
    [Required]
    public ErpInStockTypeEnum Type { get; set; } = ErpInStockTypeEnum.Purchase;

    /// <summary>
    /// 关系编号(采购/生产/销售退货)
    /// </summary>
    [Required]
    public long RelationId { get; set; }

    /// <summary>
    /// 仓库编号
    /// </summary>
    [Required]
    public long WarehouseId { get; set; }
    
    /// <summary>
    /// 仓库信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(WarehouseId))]
    public ErpWarehouse Warehouse { get; set; }

    /// <summary>
    /// 入库时间
    /// </summary>
    [Required]
    public DateTime InStockTime { get; set; } = DateTime.Now;
    
    /// <summary>
    /// 状态
    /// </summary>
    [Required]
    public ErpAuditEnum Status { get; set; } = 0;

    /// <summary>
    /// 备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}